package com.wanxi.student;

public class StudentTree implements Comparable<StudentTree> {
    private String name;
    private Integer age;

    public StudentTree() {
    }

    public StudentTree(String name, Integer age) {
        this.name = name;
        this.age = age;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public Integer getAge() {
        return age;
    }

    public void setAge(Integer age) {
        this.age = age;
    }

    @Override
    public int compareTo(StudentTree o) {
//        return this.getName().compareTo(o.getName());
        if(this.getAge().equals(o.getAge())){
           return this.getName().compareTo(o.getName());
        }
        return this.getAge()-o.getAge();
    }
}
